Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Framework] Add more flexible table definition mechanism #120

Merged
merged 2 commits into from
Oct 29, 2017

Conversation

tidoust
Copy link
Member

@tidoust tidoust commented Oct 29, 2017

This update gets rid of the HTML table templates that did not serve any useful purpose, since the logic that goes with a table needs to be implemented in the code one way or the other. Said differently, the code needs to know the structure of the tables it is to generate, so hiding that structure in an HMTL template is useless and error-prone.

The table column headers now need to appear in translation files in a columns property (see translations.json for reference).

The types of tables and the columns to display for each of them can now be customized on a roadmap per roadmap basis, in the toc.json file, in a tables property that lists the columns to use per type of table. This mechanism can be used to override the default tables or to create new types of tables.

For instance, to add the "group" column to the columns generated in "well-deployed" sections, one can simply add the following to the toc.json file:

{
  "tables": {
    "well-deployed": ["feature", "spec", "group", "maturity", "impl"]
  }
}

I created a new "versions" type of column, which should eventually become what @r12a needs in #90 (not quite the case now because the framework does not yet know how to gather the Editor's Draft and the GitHub repo of a spec)

I haven't detailed that mechanism in the README for now, because it's only going to become useful when the framework supports additional column types.

This update gets rid of the HTML table templates that did not serve any useful
purpose, since the logic that goes with a table needs to be implemented in
the code one way or the other. Said differently, the code needs to know the
structure of the tables it is to generate, so hiding that structure in an HMTL
template is useless and error-prone.

The table column headers now need to appear in translation files in a `columns`
property (see `translations.json` for reference).

The types of tables and the columns to display for each of them can now be
customized on a roadmap per roadmap basis, in the `toc.json` file, in a
`tables` property that lists the columns to use per type of table. This
mechanism can be used to override the default tables or to create new types
of tables.

For instance, to add the "group" column to the columns generated in
"well-deployed" sections, one can simply add the following to the `toc.json`
file:

```json
{
  "tables": {
    "well-deployed": ["feature", "spec", "group", "maturity", "impl"]
  }
}
```

I created a new "versions" type of column, which should eventually become what
@r12a needs in w3c#90 (not quite the case now because the framework does not
yet know how to gather the Editor's Draft and the GitHub repo of a spec)
@tidoust tidoust requested a review from xfq October 29, 2017 10:46
Copy link
Member

@xfq xfq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

js/generate.js Outdated
/**
* Code to call to generate a cell of the given type
*
* Generators should be called with an object that has the following properties:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'd prefer not to use the word "generator" here, because of the potential confusion with generator function, but I don't have a better name either. 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used "creator" to avoid any confusion. Not that it's much better, but that's all I could find ;)

@tidoust tidoust merged commit 5635d81 into w3c:master Oct 29, 2017
@tidoust tidoust deleted the framework-tables branch January 6, 2018 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants